import 'package:fig/sqlite/sql_manager.dart';
import 'package:sqflite/sqflite.dart';

// 爬取目标
class TableMediaPool extends TableBase {
  // 表名
  static final String tableName = 'media_spider';

  static final String columnSpiderName = "spider_name";
  static final String columnApiUrl = "api_url";

  @override
  createTable(Database db) {
    db.execute('''create table $tableName (
    ${TableBase.columnId} integer primary key,
    $columnSpiderName text,
    $columnApiUrl text,
    ${TableBase.columnCreateTime} integer
    )''');
  }

  @override
  insertDefault(Database db) {
    var timestamp = DateTime.now().millisecondsSinceEpoch;
    db.rawInsert('''insert into $tableName ($columnSpiderName,$columnApiUrl,${TableBase.columnCreateTime}) values 
    ('OK云','https://cj.okzy.tv/inc/feifei3ckm3u8s/',$timestamp)
    ,('酷云','http://caiji.kuyun98.com/inc/s_feifeikkm3u8/',$timestamp)
    ''');
  }
}
